//
//  SZBaseNavController.m
//  test8
//
//  Created by lanou on 16/1/21.
//  Copyright © 2016年 HuangZuCui. All rights reserved.
//

#import "SZBaseNavController.h"

@interface SZBaseNavController ()

@end

@implementation SZBaseNavController

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    [super pushViewController:viewController animated:animated];
    
    if (self.viewControllers.count > 1) {
        UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom];
        [back setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
        [back addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
        back.frame = CGRectMake(0, 10, 20, 20);
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:back];
    }
}
- (void)back {
    [self popViewControllerAnimated:YES];
}





@end
